import { defineStore } from 'pinia';
import type { ShopConfigStoreType, ShopConfigType,Response } from '@/core/models';
import { queryShopConfigV2 } from '@/core/api';
export const useShopConfigStore = defineStore('shopConfig', {
	state: () : ShopConfigStoreType => {
		return {
			config: {},
		};
	},
	getters: {
		getConfig: state => state.config,
	},
	actions: {
		async querySystemConfig() {
			const shopConfig : Response<ShopConfigType> = await queryShopConfigV2();
			this.setConfig(shopConfig.data);
		},
		setConfig(data : ShopConfigType) {
			this.config = data;
		},
	},
});